﻿package com.winmastergames.gameassets {
	import flash.display.*;
	import flash.events.*;

	public class xperience extends MovieClip {
		//XP Variables
		public static var level:Number = 1;
		public static var XP:Number = 0;
		var xpForNextLevel = 0;

		public function xperience(){
			addEventListener(Event.ENTER_FRAME, loop);
		}

		public function loop(e:Event){
			if (level == 1){
				xpForNextLevel = 1;
			} else if (level < 11){
				xpForNextLevel = 60 * level + (level * 3);
			} else if (level < 26){
				xpForNextLevel = 150 * level + (level * 4);
			} else if (level < 43){
				xpForNextLevel = 300 * level + (level * 3);
			} else if (level < 51){
				xpForNextLevel = 500 * level + (level * 2);
			} else {
				xpForNextLevel = 720 * level + (level * 2.5);
			}
			if (XP >= xpForNextLevel){
				level++;
				trace("You leveled Up!");
			}
		}
	}
}